package com.wangping.processors;

/*
 * Any consecutive occurrences of equivalent letters (after discarding letters in step 3) are considered as a single occurrence
 */
public class ConsecutiveOccurrencesProcessor extends Processor4List implements IProcessor, IProcessor4List {
	public String process(String str) {
		for (int i = 1; i<str.length(); i++) {
			char c = str.charAt(i);
			String tempstr = "" + c+ c;
			int index = str.indexOf(tempstr);
			while(index != -1){
				if((index + 1) < str.length()){
					str = str.substring(0, index) + str.substring(index+1);
				}else{
					str = str.substring(0, index);//TODO to be test
				}
				index = str.indexOf(tempstr);
			}
		}
		return str;
	}
	
	public static void main(String[] args) {

	}

}